# -*- coding: utf-8 -*-
# Python code to calculate the scores for 200m run for both boys and girls based on user input
"""
def calculate_boys_200m_score(time):
    # 定义男生200米跑的评分区间
    intervals = [(24.8, 120), (25.6, 115), (26.4, 110), (27.2, 105), (28, 100), (35.2, 40), (35.8, 35), (36.4, 30), (37, 25)]

    # 根据时间计算得分
    for i in range(len(intervals)):
        if time <= intervals[i][0]:
            if i == 0:
                return intervals[i][1]
            else:
                # 在区间内计算得分
                time_diff = intervals[i][0] - intervals[i-1][0]
                score_diff = intervals[i][1] - intervals[i-1][1]
                return intervals[i-1][1] + (intervals[i-1][0] - time) / time_diff * score_diff
    return 0

def calculate_girls_200m_score(time):
    # 定义女生200米跑的评分区间
    intervals = [(30.4, 120), (31.2, 115), (32, 110), (32.8, 105), (33.6, 100), (34.2, 95), (34.8, 90), (35.4, 85), (38.4, 60), (39, 55), (39.6, 50), (40.2, 45)]

    # 根据时间计算得分
    for i in range(len(intervals)):
        if time <= intervals[i][0]:
            if i == 0:
                return intervals[i][1]
            else:
                # 在区间内计算得分
                time_diff = intervals[i][0] - intervals[i-1][0]
                score_diff = intervals[i][1] - intervals[i-1][1]
                return intervals[i-1][1] + (intervals[i-1][0] - time) / time_diff * score_diff
    return 0

# 用户输入性别和成绩
gender = input("请输入性别（男/女）：")
time = float(input("请输入200米成绩（秒）："))

# 根据性别和成绩计算分数
if gender == "男":
    score = calculate_boys_200m_score(time)
elif gender == "女":
    score = calculate_girls_200m_score(time)
else:
    score = None
    print("性别输入错误，请输入'男'或'女'。")

if score is not None:
    print(f"200米跑成绩为 {time} 秒的分数是：{score}分")

# 这段代码允许用户输入性别和200米跑的成绩，然后根据输入的性别和成绩计算出分数。如果输入的性别不是“男”或“女”，程序会提示输入错误。
"""
import get_xlsx
import long_run

if __name__ == '__main__':
    get_xlsx.get_excel_date()




